package kr.hkit.powerjava.chapter06.work2;

import java.util.Scanner;

public class if_work03_teacher {
	public static void main(String[] args) {
		
/*		Scanner in = new Scanner (System.in);
		int gubun = -1;
		int age = 0;
		int hour = 0;
		int price = 0;
		
		
		System.out.print("자유이용권 1, 입장권이면 0, 나이, 시각(24시) ex) 1 24 14");
		gubun = in.nextInt();
		age = in.nextInt();
		hour = in.nextInt();
		// 한꺼번에 입력받기
*/		
		
		System.out.println("자유이용권, 24살, 14시 => 34000");
		System.out.println(getPrice(1,24,14));
		System.out.println("자유이용권, 3살, 14시 => 25000");
		System.out.println(getPrice(1,3,14));
		System.out.println("자유이용권, 2살, 14시 => 0");
		System.out.println(getPrice(1,2,14));
		System.out.println("자유이용권, 24살, 18시 => 29000 ");
		System.out.println(getPrice(1,24,18));
		System.out.println("자유이용권, 3살, 18시 => 21000 ");
		System.out.println(getPrice(1,3,18));
		System.out.println("자유이용권, 2살, 18시 => 0 ");
		System.out.println(getPrice(1,2,18));
		
		System.out.println("입장권, 24살, 14시 => 27000");
		System.out.println(getPrice(0,24,14));
		System.out.println("입장권, 3살, 14시 => 20000");
		System.out.println(getPrice(0,3,14));
		System.out.println("입장권, 2살, 14시 => 0");
		System.out.println(getPrice(0,2,14));
		System.out.println("입장권, 24살, 18시 => 23000");
		System.out.println(getPrice(0,24,18));
		System.out.println("입장권, 3살, 18시 => 17000");
		System.out.println(getPrice(0,3,18));
		System.out.println("입장권, 2살, 18시 => 0");
		System.out.println(getPrice(0,2,18));

	}
	
	private static int getPrice(int gubun, int age, int hour) {
		int price = -1;
		if (gubun == 1) { //자유이용권
			if (hour < 17) { //주간
				if (age < 3) { //영아 무료입장
					price = 0;
				}else{
					if (age < 13 || age > 64 ) { //소인 
						price = 25000;
					}else{ //대인
						price = 34000;
					}
				}
				
			} else { //야간
				if (age < 3) { //영아 무료입장
					price = 0;
				}else{
					if (age < 13 || age > 64 ) { //소인
						price = 21000;
					}else{ //대인
						price = 29000;
					}
				}
			}
			
		}else{//입장권 
			if (hour < 17) { //주간
				if (age < 3) { //영아 무료입장
					price = 0;
				}else{
					if (age < 13 || age > 64 ) { //소인
						price = 20000;
					}else{ //대인
						price = 27000;
					}
				}
				
			} else { //야간
				if (age < 3) { //영아 무료입장
					price = 0;
				}else{
					if (age < 13 || age > 64 ) { //소인
						price = 17000;
					}else{ //대인
						price = 23000;
					}
				}
			}
			
		}
	
		return price;
	}

}
